package de.dlrg.wms.controller.controllers.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import wms2010.interfaces.devices.IDevice;

import de.dlrg.wms.controller.controllers.ConnectivityDeviceController;
import de.dlrg.wms.controller.controllers.TrackController;
import de.dlrg.wms.model.Track;

public class TrackAdder {
	@Autowired
	private TrackController trackController;
	@Autowired
	private ConnectivityDeviceController connectivityDeviceController;

	public void execute() {
		int i = 1;
		for (IDevice iDevice : this.connectivityDeviceController.readAll()
				.get(0).getAllDevices()) {
			if (!iDevice.isStarter()) {
				this.trackController.createOrUpdate(new Track().setTrackNumber(
						i).setStopperDevice(iDevice));
				i++;
			}
			
		}
	}

}
